<?php
    header('Content-Type:application/json');
    $output=[];
    $count=4;//一次最多查询5条
    @$start = $_REQUEST['start'];//@符号可以压制当前行产生的错误提示
    //默认从0开始
    if(empty($start)) { $start = 0; }
    $conn = mysqli_connect('127.0.0.1','root','','flower');
    $sql = 'SET NAMES UTF8';
    mysqli_query($conn,$sql);
    $sql = "SELECT did,img,name,h_img,type,title,detail FROM fl_dish LIMIT $start,$count";
    $result = mysqli_query($conn, $sql);
    while(true){
            //获取数据
        $row = mysqli_fetch_assoc($result);
        if(!$row){//没有更多数据
            break;
        }
        $output[] = $row;
    }
    echo json_encode($output);
?>